#ifndef TEMPLATEMANAGER_H
#define TEMPLATEMANAGER_H

#include "manager.h"
#include <wx/event.h>
#include "globals.h"


class wxMenuBar;
class wxMenu;
class M_Code_Project;
class NewFromTemplateDlg;

class TemplateManager : public Mgr<TemplateManager>, public wxEvtHandler {
    friend class Mgr<TemplateManager>;
  public:
    void CreateMenu( wxMenuBar* menuBar );
    void ReleaseMenu( wxMenuBar* menuBar );
    void BuildToolsMenu( wxMenu* menu );
    M_Code_Project* New( TemplateOutputType initial = totProject, wxString* pFilename = nullptr );
    wxString GetLastCreatedFilename() const;
    void SaveUserTemplate( M_Code_Project* prj );
  protected:
    void LoadTemplates();
    void LoadUserTemplates();
    M_Code_Project* NewFromTemplate( NewFromTemplateDlg& dlg, wxString* pFilename = nullptr );
    M_Code_Project* NewProjectFromUserTemplate( NewFromTemplateDlg& dlg, wxString* pFilename = nullptr );
    wxArrayString m_UserTemplates;
  private:
    TemplateManager();
    virtual ~TemplateManager();
};

#endif
